/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package jfinance;

import java.io.IOException;
import java.util.LinkedList;

/**
 *
 * @author efim
 */
public class AccountsModelIOController {
    
    private IOFactory factory = new AccountsModel.FileIOFactory();
    
    public LinkedList<Account> load() throws IOException,ClassCastException{
        Object o  = (Object)factory.load();
        
        LinkedList<Account> results = (LinkedList<Account>)o;        
        return results;
    }
    
    public void save(LinkedList<Account> accounts) throws IOException{
        factory.save(accounts);
    }
    
    public void setFactory(IOFactory factory){
        this.factory = factory;
    }
}
